﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace WindowsFormsApplication2.All_FORMS.Report_forms.Report
{
    public partial class frmTailanBarimt : Form
    {
        static string BorId;
        public frmTailanBarimt(string id)
        {
            InitializeComponent();
            BorId = id;
        }

        private void frmTailanBarimt_Load(object sender, EventArgs e)
        {
            crystalReportViewer1.RefreshReport();
            ReportDocument cryRpt = new ReportDocument();
            cryRpt.Load("D:\\Диплом\\New folder\\WindowsFormsApplication2\\WindowsFormsApplication2\\All FORMS\\Report forms\\Report\\CrystalReportBarimt.rpt");

            ParameterFieldDefinitions crParameterFieldDefinitions;
            ParameterFieldDefinition crParameterFieldDefinition;

            ParameterValues crParameterValues = new ParameterValues();
            ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

            crParameterDiscreteValue.Value = BorId;
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["BorluulaltId"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;

            crParameterValues.Clear();
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();
        }
    }
}
